package com.sg.hms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sg.hms.Service.H_ApplicationService;
import com.sg.hms.ServiceImpl.H_ApplicationServiceImpl;
/**
 * 
 * @author 王奇霞
 *
 */
public class ReplyApplicationController extends HttpServlet{
     
	private H_ApplicationService aservice=new H_ApplicationServiceImpl();
	@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    	// TODO Auto-generated method stub
    	doPost(req, resp);
    }
     @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    	// TODO Auto-generated method stub
    	req.setCharacterEncoding("utf-8");
    	resp.setCharacterEncoding("utf-8");
    	PrintWriter pw=resp.getWriter();
    	int maId=Integer.parseInt(req.getParameter("maId"));
    	int aId=Integer.parseInt(req.getParameter("aId"));
    	//String state=req.getParameter("state");
    	String note=req.getParameter("note");
    	String shezhistate=req.getParameter("state");
    //	System.out.println(shezhistate);//当前后勤人员设置的申请状态
    	//System.out.println(maId+" "+aId+" "+state+" "+note);
    	int flag=aservice.replyApplication(maId,aId, shezhistate, note);
    	pw.write(String.valueOf(flag));
    	
    }
}
